#include <iostream>
#include <vector>
using namespace std;

vector<vector<int>> ans;
vector<int> track;
void backtrack(int from, int to, int k) {
    if (k == 0) {
        ans.push_back(track);
        return;
    }
    if (from > to) return;

    track.push_back(from);
    backtrack(from + 1, to, k - 1);
    track.pop_back();
    backtrack(from + 1, to, k);
}

vector<vector<int>> combine(int n, int k) {
    backtrack(1, n, k);
    return ans;
}

int main() {
    int n = 4;
    int k = 2;
    vector<vector<int>> ans = combine(n, k);
    for (int i = 0; i < ans.size(); i++) {
        for (int j = 0; j < k; j++) {
            cout << ans[i][j] << ", ";
        }
        cout << endl;
    }

    return 0;
}